package com.hzdesk.media.matvector.koreabatch.client.my_paperless.utils;

import android.content.Context;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.Toast;

/**
 * Created by Administrator on 2018/6/21.
 * 杭州席媒科技有限公司  Developers  刘传华  15
 * 佛祖镇楼 bug辟易
 */

public class MyToastUtils {
    private static Toast toast = null;
    private MyToastUtils() {
        throw new UnsupportedOperationException("不能被实例化");
    }
    /**
     * @desc 展示短时间显示的Toast
     * */
    public static void ShortToaseShow(Context mContext,String message){
        if(toast == null){
            toast = Toast.makeText(mContext,message,Toast.LENGTH_SHORT);
        }
            toast.setText(message);
            toast.show();
    }
    /**
     * @desc 展示长时间显示的Toast
     * */
    public static void LongToastShow(Context mContext,String message){
        if(toast == null){
            toast = Toast.makeText(mContext,message,Toast.LENGTH_LONG);
        }
        toast.setText(message);
        toast.show();
    }

    /**
     * 显示自定义Toast
     * @param mContext
     * @param layout
     */
    public static void ToastwithView(Context mContext,int layout){
        LayoutInflater inflater= (LayoutInflater) mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
        View view=inflater.inflate(layout,null);
        toast.setGravity(Gravity.CENTER,0,0);
        toast.setView(view);
        toast.show();

    }


}
